package org.usmile.algorithms.huawei.acm;

import java.util.Arrays;
import java.util.Scanner;

// https://blog.csdn.net/qq_34465338/article/details/128331450
public class _取出尽量少的球 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum = sc.nextInt();
        int bucketNum = sc.nextInt();
        int totalBalls = 0;
        int max = Integer.MIN_VALUE;
        int[] bucketBalls = new int[bucketNum];
        for (int i = 0; i < bucketNum; i++) {
            bucketBalls[i] = sc.nextInt();
            totalBalls += bucketBalls[i];
            max = Math.max(max, bucketBalls[i]);
        }

        if (totalBalls > sum) {
            int min = sum / bucketNum;
            int[] result = new int[0];
            for (int i = min; i <= max; i++) {
                int[] pick = new int[bucketNum];
                int out = 0;
                for (int j = 0; j < bucketNum; j++) {
                    int picked = bucketBalls[j] > i ? bucketBalls[j] - i : 0;
                    out += picked;
                    pick[j] = picked;
                }

                if (totalBalls - out > sum) {
                    break;
                } else {
                    result = pick;
                }
            }
            System.out.println(Arrays.toString(result));
        } else {
            System.out.println(Arrays.toString(new int[]{}));
        }
    }
}
